{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;\red63\green95\blue191;\red127\green159\blue191;\red127\green0\blue85;
\red0\green0\blue192;\red63\green127\blue95;}
\margl1440\margr1440\vieww16060\viewh9140\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 Task 3- Rectangle\
\
2.  Fixing the Bug\
This task was very simple. When running the jUnit tester, we saw that the expected assertion should be a double of 10.0 but we received a 25.0. This lead me to believe that there was bug regarding the doubles that were beings used to create points. Indeed, this was the case. In the Point.java, this.x was set to the y value that was passed in. Changing "this.x = y" to "this.x = x" and then running the jUnit test produces no failures.\
\
3. Modified Methods\
For modifying the methods I included some method comments as well as split up the return statement into a number of logical steps.\
\pard\pardeftab720

\f1\fs22 \cf0 	\cf2 /**\cf0 \
\pard\pardeftab720
\cf2 	 * Gets the area.\cf0 \
\cf2 	 * \cf0 \
\cf2 	 * Uses two global Point objects and their respective x and y coordinates\cf0 \
\cf2 	 * to calculate the rectangle's area\cf0 \
\cf2 	 *\cf0 \
\cf2 	 * \cf3 @return\cf2  the area\cf0 \
\cf2 	 */\cf0 \
	\cf4 public\cf0  Double getArea() \{\
		Double xDiff = \cf5 p2\cf0 .\cf5 x\cf0  - \cf5 p1\cf0 .\cf5 x\cf0 ;\
		Double yDiff = \cf5 p2\cf0 .\cf5 y\cf0  - \cf5 p1\cf0 .\cf5 y\cf0 ;\
		Double area = Math.abs(xDiff*yDiff);\
		\
		\cf6 //return Math.abs((p2.x - p1.x) * (p2.y - p1.y));\cf0 \
		\cf4 return\cf0  area;\
	\}\
	\
	\cf2 /**\cf0 \
\cf2 	 * Gets the diagonal.\cf0 \
\cf2 	 * \cf0 \
\cf2 	 * Uses two global Point objects and their respective x and y coordinates\cf0 \
\cf2 	 * to calculate the rectangle's diagonal line\cf0 \
\cf2 	 *\cf0 \
\cf2 	 * \cf3 @return\cf2  the diagonal\cf0 \
\cf2 	 */\cf0 \
	\cf4 public\cf0  Double getDiagonal() \{\
		Double xDiff = \cf5 p2\cf0 .\cf5 x\cf0  - \cf5 p1\cf0 .\cf5 x\cf0 ;\
		Double yDiff = \cf5 p2\cf0 .\cf5 y\cf0  - \cf5 p1\cf0 .\cf5 y\cf0 ;\
		Double xPow = Math.pow(xDiff, 2);\
		Double yPow = Math.pow(yDiff, 2);\
		Double diagonal = Math.sqrt(xPow + yPow);\
		\
		\cf6 //return Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow((p2.y - p1.y), 2));\cf0 \
		\cf4 return\cf0  diagonal;\
	\}}